

#ifndef QCPPIALOGIMPL_H
#define QCPPIALOGIMPL_H

#include <qtimer.h>
#include "ui_mainwin.h"
#include "serialthread.h"
#define NAME_AND_VERSION    "Com friend 0.9"
#define IN_PUT_HISTORY_MAX  20

#define INPUT_LINE_END_LF   0
#define INPUT_LINE_END_CR   1
#define INPUT_LINE_END_LF_CR   2
#define INPUT_LINE_END_NONE   3

class QMainWin:public QWidget, public Ui::mainwin
{
   Q_OBJECT
   public:
      QMainWin(QWidget* parent);
      ~QMainWin();

   protected:
      void keyPressEvent(QKeyEvent *event);

   protected slots:
      void strInput();
      void hexInput();
      void FindAutoFile();
      void startAuto();
      void showHelp();
      void showAboutMsg();
      void showSetupDlg();
      void oldStrCmdClicked(QListWidgetItem* item);
      void oldHexCmdClicked(QListWidgetItem* item);
      void fontBtClick();
      void colorBtClick();
      void bgColorBtClick();
      void connectBtClick();
      bool doconnect();
      bool disconnect();
      void clearOutput();
      void EnableNewFilter();
      void ReceiveString(QString * str);
	void ReceiveExeCmd(cmdList * cmd);

private slots:
      void hexInputTextChanged(const QString & text);

private :
      void UpdateFilterView(QString str);
      bool maintainHistory(QListWidget * pLw ,QString cmd , bool AllowDup = false);
      void saveSettings();
      void readSettings();


      bool m_FilterEnable;
      bool m_isConnected;
      int m_filterOutCount;
      QStringList m_FilterStringList;

      CSerialThread m_serialThread;
};

#endif
